const qiniu = require('qiniu-js')
const config = {
  useCdnDomain: true,
  region: qiniu.region.z0
}
const putExtra = {
  fname: '',
  params: {},
  mimeType: null
}

var uploader = (uptoken, file, observer) => {
  var observable = qiniu.upload(file, null, uptoken, putExtra, config)
  var subscription = observable.subscribe(observer)
  return subscription
  // var getUrl = qiniu.getUploadUrl(config)
  // subscription.unsubscribe() // 上传取消
}
export default uploader
